package com.crealth.crmserver;


import org.apache.mina.core.session.IoSession;

import com.crealth.handler.ResponseMsgQueue;
import com.crealth.msg.NetMessageData;

public class ResponseMsgThread2 extends CommonThread {
	//private static Logger logger = Logger.getLogger("running_log");
	//private static Logger errorLog = Logger.getLogger("error_log");	
	

	@Override
	public void execute() throws Exception {
		NetMessageData msg = ResponseMsgQueue.getResponseMsg();
		if (msg == null) {
			return;
		}
		
		int userID = msg.getUserID();
		if (userID <= 0) {
			return;
		}
		//int cmd = msg.getMsgCmd();
		IoSession session = SessionManager.getUserSessionByID(userID);
		if (session != null && session.isConnected()) {				
			session.write(msg);
			//String sendInfo = "send userID: " + userID + "  cmd: "+cmd;
			//logger.info(sendInfo);
		}
	}
	
}
